package com.echo.yiwei.contoller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.echo.util.GsonUtil;
import com.echo.util.ParamesList;
import com.echo.util.StringEchoUtil;
import com.echo.util.ValidateUtil;
import com.echo.yiwei.serivce.BusinessSerivce;

/**
 * 
 * @author tangsixiang
 *  定了 接口相关请求方法的命名规范：[save update delete find]
 */
@WebServlet(urlPatterns={"/userInterface/*","/productInterface/*"},loadOnStartup=1)
public class ContollerSerlvet  extends HttpServlet{
	private static final long serialVersionUID = 7679797397011746219L;

	private static Logger  log= LoggerFactory.getLogger(ContollerSerlvet.class);
	
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		  doPost(req, resp);
	}
	
	/**
	 * 程序的入口
	 * 
	 */
	@SuppressWarnings("unchecked")
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		 log.info( request.getPathInfo());
		Map<String,String> map= (Map<String, String>) request.getAttribute("paramesMap");
		   String responsejsonStr=null;
			   //进入业务处理层
			    responsejsonStr=BusinessSerivce.returnResultbusiness(map);
		  log.info("-------业务处理完成 --准备response响应到前段------------");
		   //给前端响应json格式字符串
		  StringEchoUtil.toClient(responsejsonStr, response);
}

	
	
	
	
	
}
